package com.ruoyi.web.controller.wq;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.framework.web.service.CommentService;
import com.ruoyi.wq.domain.WqComment;
import com.ruoyi.wq.domain.vo.WqCommentVO;
import com.ruoyi.wq.service.IWqCommentService;

/**
 * 动态评论Controller
 * 
 * @author ruoyi
 * @date 2022-03-29
 */
@RestController
@RequestMapping("/wq/comment")
public class WqCommentController extends BaseController {
	
    @Autowired
    private IWqCommentService wqCommentService;
    
    @Autowired
    private CommentService commentService;

    /**
     * 查询动态评论列表
     */
    @GetMapping("/list")
    public TableDataInfo list(WqComment wqComment)
    {
        startPage();
        List<WqComment> list = wqCommentService.selectWqCommentList(wqComment);
        return getDataTable(list);
    }
    
    /**
     * 查询动态评论列表
     */
    @GetMapping("/getList")
    public TableDataInfo getList(WqCommentVO wqComment) {
    	TableDataInfo info = wqCommentService.getWqCommentList(wqComment);
        return info;
    }

    /**
     * 新增动态评论
     */
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody WqComment wqComment){
        return toAjax(commentService.insertWqComment(wqComment));
    }

    /**
     * 删除动态评论
     */
	@GetMapping("/delete")
    public AjaxResult delete(String id) {
        return toAjax(wqCommentService.deleteById(id));
    }
}
